package cn.com.dcsgo.springcloudstudy.order.controller;

import cn.com.dcsgo.springcloudstudy.commons.pojo.CommonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * 一个简单的演示controller
 *
 * @author Dcsgo
 * @since 2024/8/2 上午10:06
 */
@RestController
@Slf4j
public class SampleController {
    public static final String PAYMENT_URL = "http://cloud-provider-payment";

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/consumer/payment/consul")
    public CommonResult<String> getSample(){
        return restTemplate.getForObject(PAYMENT_URL+"/payment/consul",CommonResult.class);
    }
}
